<?php
@require_once("bin/data.php");
@session_start();

$user = getUser(@$_SESSION['userid']);

$credlink = <<<EOF
<td>
	<a href="join.php" id="header_right">Register</a>
</td>
<td>
	<a href="signin.php" id="header_right">Login</a>
</td>
EOF;
if (isset($_COOKIE['userid'])&&(strlen($_COOKIE['userid'])>0)&&($_COOKIE['userid']!='-1'))
{
	$credlink = <<<EOF
<td align="right">
	<span id="header_right">Welcome, <a href="profile.php" id="header_right">{$user['first']}</a></span>
	<a href="signin.php?so=true" id="header_right">Logout</a>
</td>
EOF;
}
$query = @$_SESSION['query'];

$channel = @$_SESSION["channel"];
	
$categorylist = getCategoryList($channel);

/*
	the follow is just nasty. Can't seem to figure out
	a clean way to get better code reuse.
*/
$channeltext = "<ul>";
$sql = "SELECT * FROM `$tblcategory` order by title ASC;";
$result = @mysql_query($sql);
while($row=@mysql_fetch_array($result))
{
	$subchannel = <<<EOF
	<li><a href="channel.php?channel={$row['id']}">{$row['title']}</a></li>
EOF;
$channeltext = $channeltext.$subchannel;
}
$channeltext = $channeltext."</ul>";

$html = <<<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
    <title>{$title} - TODO! | Keyword, Keyword, Keyword</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta name="KEYWORDS" content="TODO!">
	<meta name="DESCRIPTION" content="TODO!">
	<meta name="author" content="Triggerman">
	<meta name="copyright" content="2012, http://www.TODO!.com">
	<meta name="generator" content="GEdit, gdt">
	<link href='http://fonts.googleapis.com/css?family=Lobster+Two' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Carter+One' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="css/main.css" type="text/css">
	<link rel="shortcut Icon" href="favicon.ico" type="image/x-icon">
	{$link}
	<script type="text/javascript">
	function sel()
	{
		var selObj=document.getElementById('channelselect');
		location.href="channel.php?channel="+selObj.options[selObj.selectedIndex].value;
	}
	</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr id="header_row1">
	<td></td>
	<td colspan="2">
		<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
		<tr>
		<td>
			<a href="index.php"><img src="images/press/logo_white_128_80.png" width="48" border="0" /></a>
		</td>
		<td nowrap>
			<span id="header_right">Channel: </span><select name="channelselect" id="channelselect" onchange="sel();">{$categorylist}</select>
		</td>
		<td>
			<div id="searchwrapper">
			<form action="index.php" method="get">
				<input type="text" name="q" id="searchbox" value="{$query}">
				<input type="image" name="s" id="searchbutton" src="images/searchbutton.png" value="" />
			</form>
			</div>
		</td>
		<td>
			<a href="upload.php" id="header_right">New Glide</a>
		</td>
		

		{$credlink}
		</tr>
		</table>
		
	</td>
	<td ></td>
</tr>

<tr>
	<td id="leftcolumn">
	
	</td>
	<td id="centercolumn">	
	<br />
	{$content}
	</td>
	<td id="adcolumn" valign="top">
	<div id="ad_frame">ADVERTISING
	<div id="ad_innerframe">
	<script type="text/javascript"><!--
google_ad_client = "ca-pub-7517999202360512";
/* Glidecast Block */
google_ad_slot = "6783164206";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</div>
	</td>
	<td id="rightcolumn">
	
	</td>
</tr>
<tr id="footer_row1">
	<td></td>
	<td colspan="2">
	<br />
	<hr />
	<table width="100%">
		<tr>
			<td valign="top">
				<img src="images/press/logo_white_128_80.png" />
			</td>
			<td valign="top">
				<li>Channels
				{$channeltext}
				</li>
			</td>
			<td valign="top">
				    <li><a href="/en-US/firefox/channel/">Partners</a>
				    <ul><li><a href="/en-US/firefox/channel/">Flackbash</a></li>
				    <li><a href="/en-US/firefox/aurora/">Loopio</a></li>
				    <li><a href="/beta/">Gutorials</a></li>
				    </ul></li>
			</td>
			<td valign="top">
				    <li><a href="http://support.mozilla.org/">Community</a>
				    <ul id="ful">
				    <li><a href="http://www.glidecast.com/forum">Forum</a></li>
				    <li><a href="http://www.glidecast.com/blog">Blog</a></li>
				    <li><a href="http://www.twitter.com/glidecast">@glidecast</a></li>
				    <li><a href="http://www.facebook.com/glidecast">Facebook</a></li>
				    <li><a href="http://www.boxee.com/glidecast">Boxee</a></li>
				    </ul></li>
			</td>
			<td valign="top">
				    <li><a href="/en-US/firefox/about/">About</a>
				    <ul id="ful">
				    <li><a href="/en-US/firefox/about/">About Glidecast</a></li>
				    <li><a href="/en-US/press/">Press Center</a></li>
				    <li><a href="/en-US/about/careers.html">Careers</a></li>
				    <li><a href="/en-US/about/contact.html">Contact Us</a></li></ul></li>
			</td>
		</tr>
	</table>
		<div id="copyright">
			<p id="footer-links"><a href="/en-US/privacy-policy.html">Privacy Policy</a> &nbsp;|&nbsp; 
			<a href="/en-US/about/legal.html">Legal Notices</a> &nbsp;|&nbsp;
                        <a href="/en-US/legal/fraud-report/index.html">Report Trademark Abuse</a></p>			
		</div>
	</td>
	<td></td>
</tr>
</table>
</body>
</html>
EOF;
?>
